import request from '@/utils/request'


// 消息相关接口
export const messageApi = {
    // 获取消息列表
    getMessages(params) {
        return request({
            url: '/message/list',
            method: 'get',
            params
        })
    },

    // 获取未读消息数量
    getUnreadCount() {
        return request({
            url: '/message/unread/count',
            method: 'get'
        })
    },

    // 标记消息为已读
    markAsRead(data) {
        return request({
            url: '/message/read',
            method: 'post',
            data
        })
    },

    // 获取点赞消息
    getLikeMessages(params) {
        return request({
            url: '/message/likes',
            method: 'get',
            params
        })
    },

    // 获取评论消息
    getCommentMessages(params) {
        return request({
            url: '/message/comments',
            method: 'get',
            params
        })
    },

    // 获取关注消息
    getFollowMessages(params) {
        return request({
            url: '/message/follows',
            method: 'get',
            params
        })
    },

    // 获取系统消息
    getSystemMessages(params) {
        return request({
            url: '/message/system',
            method: 'get',
            params
        })
    },

    // 删除消息
    deleteMessage(id) {
        return request({
            url: `/message/delete/${id}`,
            method: 'delete'
        })
    },

    // 清空所有消息
    clearAllMessages(type) {
        return request({
            url: '/message/clear',
            method: 'post',
            data: { type }
        })
    }
}